// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import {getSignature} from './api/signature.js'
import wx from 'weixin-js-sdk'
Vue.config.productionTip = false
import {
  XHeader,XButton,Grid, GridItem,Calendar,CellBox,
  Cell,CheckIcon, Checker,PopupRadio,Picker,Radio,
  Selector,Actionsheet,Alert,Confirm,InlineLoading,
  LoadMore,Loading,Msg,Toast,XInput,InlineCalendar,
  CheckerItem,Checklist,DatetimeView,DatetimeRange,
  Datetime,FormPreview,Group,InlineXSwitch,PopupPicker,AlertPlugin} from 'vux'
Vue.use(AlertPlugin)
Vue.component('x-header', XHeader)
Vue.component('x-button', XButton)
Vue.component('grid', Grid)
Vue.component('grid-item', GridItem)
Vue.component('calender', Calendar)
Vue.component('cell-box', CellBox)
Vue.component('cell', Cell)
Vue.component('checker', Checker)
Vue.component('popup-radio', PopupRadio)
Vue.component('picker', Picker)
Vue.component('radio', Radio)
Vue.component('selector', Selector)
Vue.component('actionsheet', Actionsheet)
Vue.component('alert', Alert)
Vue.component('confirm', Confirm)
Vue.component('inline-loading', InlineLoading)
Vue.component('load-more', LoadMore)
Vue.component('loading', Loading)
Vue.component('msg', Msg)
Vue.component('toast', Toast)
Vue.component('x-input', XInput)
Vue.component('inline-calendar', InlineCalendar)
Vue.component('checker-item', CheckerItem);
Vue.component('checklist', Checklist);
Vue.component('datetime-view', DatetimeView);
Vue.component('datetime-range', DatetimeRange);
Vue.component('datetime', Datetime);
Vue.component('form-preview', FormPreview);
Vue.component('group', Group);
Vue.component('inline-x-switch', InlineXSwitch);
Vue.component('checklist', PopupPicker);



getSignature().then(function (result) {
  let {noncestr,signature,timestamp,jsApiList} = result.data;
  wx.config({
    // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
    debug: false,
    // 必填，公众号的唯一标识
    appId: 'wxee7ebdd886b8b2b6',
    // 必填，生成签名的时间戳
    timestamp: timestamp,
    // 必填，生成签名的随机串
    nonceStr: noncestr,
    // 必填，签名
    signature: signature,
    // 必填，需要使用的JS接口列表，所有JS接口列表
    jsApiList: jsApiList
  });

}).catch(function (error) {
  console.info(error);
});

wx.error(function (res) {
  alert("出错了：" + res.errMsg);//这个地方的好处就是wx.config配置错误，会弹出窗口哪里错误，然后根据微信文档查询即可。
});



/* eslint-disable no-new */
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
